//
//  KRAppDelegate.h
//  KingrayTone_ios
//
//  Created by XiongYingqi on 14-5-14.
//  Copyright (c) 2014年 XiongYingqi. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "XMPPFramework.h"

@class XMPPMessageArchivingCoreDataStorage;
@class XMPPMessageArchiving;


extern NSString *const kXMPPmyJID;
extern NSString *const kXMPPmyPassword;

@interface KRAppDelegate : UIResponder <UIApplicationDelegate, XMPPRosterDelegate> {
    XMPPStream *xmppStream;
    XMPPReconnect *xmppReconnect;
    XMPPRoster *xmppRoster;
    XMPPRosterCoreDataStorage *xmppRosterStorage;
    XMPPGroupCoreDataStorageObject *xmppGroupStorage;
    XMPPvCardCoreDataStorage *xmppvCardStorage;
    XMPPvCardTempModule *xmppvCardTempModule;
    XMPPvCardAvatarModule *xmppvCardAvatarModule;
    XMPPCapabilities *xmppCapabilities;
    XMPPCapabilitiesCoreDataStorage *xmppCapabilitiesStorage;
    XMPPMessageArchivingCoreDataStorage *xmppMessageArchivingCoreDataStorage;
    XMPPMessageArchiving *xmppMessageArchivingModule;
//    XMPPMessageArchivingCoreDataStorage *xmppMessageArchivingStorage;

    NSString *password;

    BOOL customCertEvaluation;

    BOOL isXmppConnected;

}

+ (KRAppDelegate *)appDelegate;


- (void)setupStream;

- (void)teardownStream;

- (void)goOnline;

- (void)goOffline;

- (BOOL)connect;

- (void)disconnect;

@property(nonatomic, strong, readonly) XMPPStream *xmppStream;
@property(nonatomic, strong, readonly) XMPPReconnect *xmppReconnect;
@property(nonatomic, strong, readonly) XMPPRoster *xmppRoster;
@property(nonatomic, strong, readonly) XMPPRosterCoreDataStorage *xmppRosterStorage;
@property(nonatomic, strong, readonly) XMPPvCardTempModule *xmppvCardTempModule;
@property(nonatomic, strong, readonly) XMPPvCardAvatarModule *xmppvCardAvatarModule;
@property(nonatomic, strong, readonly) XMPPCapabilities *xmppCapabilities;
@property(nonatomic, strong, readonly) XMPPCapabilitiesCoreDataStorage *xmppCapabilitiesStorage;


@property(strong, nonatomic) UIWindow *window;

@property(strong, nonatomic) IBOutlet UITabBarController *tabBarController;

//@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
//@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
//@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

//- (void)saveContext;
//
//- (NSURL *)applicationDocumentsDirectory;

- (NSManagedObjectContext *)managedObjectContext_roster;

- (NSManagedObjectContext *)managedObjectContext_capabilities;

- (NSManagedObjectContext *)managedObjectContext_message;

@end
